//  业务工具类

// 获取树形结构中的某个节点
export function getTreeItemById(list, id) {
  let childrenArr = [];
  let item = list.find((e) => {
    if (e.id === id) {
      return e;
    }
    if (e && e.children && e.children.length > 0) {
      childrenArr = childrenArr.concat(e.children);
    }
  });
  if (!item && childrenArr && childrenArr.length > 0) {
    item = getTreeItemById(childrenArr, id);
  }
  return item;
}
